package com.sisyphus.simple.data.network.model;

import com.sisyphus.spinach.core.model.IResponse;

public class BaseResponse<T> implements IResponse<T> {

    private T data;
    private int code;
    private String message;

    public BaseResponse() {
    }

    public BaseResponse(T data) {
        this.data = data;
        this.code = 200;
        this.message = "success";
    }

    public BaseResponse(T data, int code, String message) {
        this.data = data;
        this.code = code;
        this.message = message;
    }

    @Override
    public boolean isSuccessful() {
        return code == 200;
    }

    @Override
    public int getErrorCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public T getData() {
        return data;
    }

}
